<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>My Project: kernel.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">My Project
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">kernel.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#ifndef _KERNEL_HPP_</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor">#define _KERNEL_HPP_  1</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#include &lt;functional&gt;</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#include &lt;utility&gt;</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">#include &lt;cstdint&gt;</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#include &lt;setjmp.h&gt;</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &quot;port.hpp&quot;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#include &quot;signalvars.hpp&quot;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="preprocessor">#include &quot;rafttypes.hpp&quot;</span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="keyword">class </span><a class="code" href="class_map_base.html">MapBase</a>;</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="keyword">class </span><a class="code" href="class_schedule.html">Schedule</a>;</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="keyword">class </span><a class="code" href="classkernel__container.html">kernel_container</a>;</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="keyword">class </span><a class="code" href="class_map.html">Map</a>;</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="keyword">class </span><a class="code" href="classbasic__parallel.html">basic_parallel</a>;</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="preprocessor">#ifndef CLONE</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespaceraft.html">raft</a></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;{</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;   <span class="keyword">class </span>kernel;</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;}</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="preprocessor">#define CLONE() \</span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="preprocessor">virtual raft::kernel* clone()\</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="preprocessor">{ \</span></div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="preprocessor">   auto *ptr( \</span></div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="preprocessor">      new typename std::remove_reference&lt; decltype( *this ) &gt;::type( ( *(\</span></div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="preprocessor">   (typename std::decay&lt; decltype( *this ) &gt;::type * ) \</span></div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="preprocessor">   this ) ) ) );\</span></div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="preprocessor">   return( ptr );\</span></div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="preprocessor">}</span></div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespaceraft.html">raft</a> {</div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="classraft_1_1kernel.html">   57</a></span>&#160;<span class="keyword">class </span><a class="code" href="classraft_1_1kernel.html">kernel</a></div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;{</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;   <a class="code" href="classraft_1_1kernel.html#a57aa6c7842f594d1522fb1c127fc4588">kernel</a>();</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;   </div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;   <a class="code" href="classraft_1_1kernel.html#a57aa6c7842f594d1522fb1c127fc4588">kernel</a>( <span class="keywordtype">void</span> * <span class="keyword">const</span> ptr,</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;           <span class="keyword">const</span> std::size_t nbytes );</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;   <span class="keyword">virtual</span> ~<a class="code" href="classraft_1_1kernel.html">kernel</a>();</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;   <span class="keyword">virtual</span> raft::kstatus <a class="code" href="classraft_1_1kernel.html#a05094286d7577360fb1b91c91fc05901">run</a>() = 0;</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;   </div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;   <span class="keyword">template</span> &lt; <span class="keyword">class </span>T ,</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;               <span class="keyword">class </span>... Args &gt;</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;      <span class="keyword">static</span> <a class="code" href="classraft_1_1kernel.html">kernel</a>* make( Args&amp;&amp;... params )</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;      {</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;         <span class="keywordflow">return</span>( <span class="keyword">new</span> T( std::forward&lt; Args &gt;( params )... ) );</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;      }</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;   </div>
<div class="line"><a name="l00096"></a><span class="lineno"><a class="line" href="classraft_1_1kernel.html#a71bfffbbb3d40949e19be32e3d8f467f">   96</a></span>&#160;   <span class="keyword">virtual</span> <a class="code" href="classraft_1_1kernel.html">raft::kernel</a>* <a class="code" href="classraft_1_1kernel.html#a71bfffbbb3d40949e19be32e3d8f467f">clone</a>()</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;   {</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;      <span class="comment">//FIXME, needs to throw an exception</span></div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;      assert( <span class="keyword">false</span> );</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;      <span class="keywordflow">return</span>( <span class="keyword">nullptr</span> );</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;   }</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;   std::size_t get_id();</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;   <span class="keyword">virtual</span> std::size_t addPort();</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;   </div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classraft_1_1kernel.html#abd7f3bf1f689840f7d61f472f520c258">lock</a>();</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classraft_1_1kernel.html#a7966dcabb0ed65ac52f6f78918256861">unlock</a>();</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;</div>
<div class="line"><a name="l00117"></a><span class="lineno"><a class="line" href="classraft_1_1kernel.html#a6edbe35a56409d402e719b3ac36d6554">  117</a></span>&#160;   <a class="code" href="class_port.html">Port</a>               <a class="code" href="classraft_1_1kernel.html#a6edbe35a56409d402e719b3ac36d6554">input</a>  = { <span class="keyword">this</span> };</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;   <a class="code" href="class_port.html">Port</a>               output = { <span class="keyword">this</span> };</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160; </div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;   <span class="keyword">friend</span> class ::MapBase;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;   <span class="keyword">friend</span> class ::Map;</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;   <span class="keyword">friend</span> class ::Schedule;</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;   <span class="keyword">friend</span> class ::GraphTools;</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;   <span class="keyword">friend</span> class ::kernel_container;   </div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;   <span class="keyword">friend</span> class ::basic_parallel;</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;</div>
<div class="line"><a name="l00133"></a><span class="lineno"><a class="line" href="classraft_1_1kernel.html#a98e05f7418c208e28b9112e92df7eccf">  133</a></span>&#160;   <span class="keyword">static</span> std::size_t <a class="code" href="classraft_1_1kernel.html#a98e05f7418c208e28b9112e92df7eccf">kernel_count</a>;</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;   <span class="keywordtype">bool</span>   dup_enabled   = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;   <span class="keywordtype">bool</span>   dup_candidate = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;   <span class="keyword">const</span>  std::size_t kernel_id;</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;};</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;} </div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* END _KERNEL_HPP_ */</span><span class="preprocessor"></span></div>
<div class="ttc" id="classraft_1_1kernel_html_a6edbe35a56409d402e719b3ac36d6554"><div class="ttname"><a href="classraft_1_1kernel.html#a6edbe35a56409d402e719b3ac36d6554">raft::kernel::input</a></div><div class="ttdeci">Port input</div><div class="ttdef"><b>Definition:</b> kernel.hpp:117</div></div>
<div class="ttc" id="classbasic__parallel_html"><div class="ttname"><a href="classbasic__parallel.html">basic_parallel</a></div><div class="ttdef"><b>Definition:</b> basicparallel.hpp:48</div></div>
<div class="ttc" id="classraft_1_1kernel_html_a57aa6c7842f594d1522fb1c127fc4588"><div class="ttname"><a href="classraft_1_1kernel.html#a57aa6c7842f594d1522fb1c127fc4588">raft::kernel::kernel</a></div><div class="ttdeci">kernel()</div><div class="ttdef"><b>Definition:</b> kernel.cpp:11</div></div>
<div class="ttc" id="class_map_base_html"><div class="ttname"><a href="class_map_base.html">MapBase</a></div><div class="ttdef"><b>Definition:</b> mapbase.hpp:100</div></div>
<div class="ttc" id="classraft_1_1kernel_html_a7966dcabb0ed65ac52f6f78918256861"><div class="ttname"><a href="classraft_1_1kernel.html#a7966dcabb0ed65ac52f6f78918256861">raft::kernel::unlock</a></div><div class="ttdeci">virtual void unlock()</div><div class="ttdef"><b>Definition:</b> kernel.cpp:51</div></div>
<div class="ttc" id="classraft_1_1kernel_html_a05094286d7577360fb1b91c91fc05901"><div class="ttname"><a href="classraft_1_1kernel.html#a05094286d7577360fb1b91c91fc05901">raft::kernel::run</a></div><div class="ttdeci">virtual raft::kstatus run()=0</div></div>
<div class="ttc" id="class_map_html"><div class="ttname"><a href="class_map.html">Map</a></div><div class="ttdef"><b>Definition:</b> map.hpp:47</div></div>
<div class="ttc" id="classraft_1_1kernel_html_a71bfffbbb3d40949e19be32e3d8f467f"><div class="ttname"><a href="classraft_1_1kernel.html#a71bfffbbb3d40949e19be32e3d8f467f">raft::kernel::clone</a></div><div class="ttdeci">virtual raft::kernel * clone()</div><div class="ttdef"><b>Definition:</b> kernel.hpp:96</div></div>
<div class="ttc" id="classraft_1_1kernel_html_abd7f3bf1f689840f7d61f472f520c258"><div class="ttname"><a href="classraft_1_1kernel.html#abd7f3bf1f689840f7d61f472f520c258">raft::kernel::lock</a></div><div class="ttdeci">virtual void lock()</div><div class="ttdef"><b>Definition:</b> kernel.cpp:44</div></div>
<div class="ttc" id="class_port_html"><div class="ttname"><a href="class_port.html">Port</a></div><div class="ttdef"><b>Definition:</b> port.hpp:57</div></div>
<div class="ttc" id="class_schedule_html"><div class="ttname"><a href="class_schedule.html">Schedule</a></div><div class="ttdef"><b>Definition:</b> schedule.hpp:34</div></div>
<div class="ttc" id="classraft_1_1kernel_html"><div class="ttname"><a href="classraft_1_1kernel.html">raft::kernel</a></div><div class="ttdef"><b>Definition:</b> kernel.hpp:57</div></div>
<div class="ttc" id="namespaceraft_html"><div class="ttname"><a href="namespaceraft.html">raft</a></div><div class="ttdef"><b>Definition:</b> globalmap.cpp:3</div></div>
<div class="ttc" id="classkernel__container_html"><div class="ttname"><a href="classkernel__container.html">kernel_container</a></div><div class="ttdef"><b>Definition:</b> kernelcontainer.hpp:36</div></div>
<div class="ttc" id="classraft_1_1kernel_html_a98e05f7418c208e28b9112e92df7eccf"><div class="ttname"><a href="classraft_1_1kernel.html#a98e05f7418c208e28b9112e92df7eccf">raft::kernel::kernel_count</a></div><div class="ttdeci">static std::size_t kernel_count</div><div class="ttdef"><b>Definition:</b> kernel.hpp:133</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.10
</small></address>
</body>
</html>
